<?php 
require 'includes/db.php';
	require_once("includes/mail.class.php");
	
	$sendmail = new admin_user();
 if(isset($_POST['submit']))
		{
		   $sql_license="select * from admin_user where email='".$_POST['email']."'";
		   $result_license=mysql_query($sql_license) or die(mysql_error());
		   if(mysql_num_rows($result_license) > 0)
		   {
			$password=mysql_fetch_array($result_license) or die(mysql_error());
			$order_id = uniqid(rand(5,1000),false)."<br>";
			$order_id = substr($order_id,rand(0,strlen($order_id)-8),5);
			$random1=$order_id;
			$random=$random1;
			$sendemail=$sendmail->forgetpass_mail($password['email'],$random1);
			$update1="UPDATE admin_user SET `password`='$random'";
			mysql_query($update1) or die(mysql_error());
			header('location:index.php?msg=New Password Successfully Mailed To You');
		}
	
		else
		{
                       echo error("Invalid Email");
					
		 }
			
	  
      }   
 ?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="../images/favicon.png">

    <title>Cyberlinks Admin Panel</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="css/signin.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy this line! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>

    <div class="container">

      <form class="form-signin" role="form" method="post" action="">
        <h2 class="form-signin-heading">Reset Your Password</h2>
        <input name="email" type="email" class="form-control" placeholder="Email address" required autofocus>
       </br>
        <button class="btn btn-lg btn-primary btn-block" type="submit" name="submit">Reset Password</button>
      </form>

    </div> <!-- /container -->


    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/docs.min.js"></script>
  </body>
</html>
